﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Private_RedirectOnUserType : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        if (Session.IsNewSession)
        {
            // If it says it is a new session, but an existing cookie exists, then it must 
            // have timed out (can't use the cookie collection because even on first 
            // request it already contains the cookie (request and response
            // seem to share the collection)
            string szCookieHeader = Request.Headers["Cookie"];
            if ((null != szCookieHeader) && (szCookieHeader.IndexOf("ASP.NET_SessionId") >= 0))
            {
                Response.Redirect("sessionTimeout.aspx");
            }
        }

        if (this.Session["userType"] != null)
        {
            if (this.Session["userType"].ToString() == "Client") this.Response.Redirect("~/Private/ViewPriceQuotes.aspx");
            else if (this.Session["userType"].ToString() == "Company") this.Response.Redirect("~/Private/ViewPriceQuotesComp.aspx");
        }
    }
}
